/**
 * Created by Administrator on 2018/3/7.
 */


$(function () {

    // 开始写 jQuery 代码...
    //$("p.hh").click(function () {
    //    alert("这是一个弹出框");
    //});
    //
    function getCookie(cname) {
        var name = cname + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i].trim();
            if (c.indexOf(name) == 0) {
                return c.substring(name.length, c.length);
            }
        }
        return "";
    }

    function add0(m) {
        return m < 10 ? '0' + m : m
    }

    function format(shijianchuo) {
//shijianchuo是整数，否则要parseInt转换
        var time = new Date(shijianchuo);
        var y = time.getFullYear();
        var m = time.getMonth() + 1;
        var d = time.getDate();
        var h = time.getHours();
        var mm = time.getMinutes();
        var s = time.getSeconds();
        return y + '-' + add0(m) + '-' + add0(d);
    }


    $.get("/paper/" + window.location.href.split('?')[1].split('=')[1], function (data) {


        for (var i = 0; i < data.length; i++) {

            $("ul").append("<li><span>" + format(JSON.parse(data[i].makeDate)) + "</span><a href = '/article-detail.html?articleId=" + JSON.stringify(data[i].articleId)
                + "'>" + JSON.stringify(data[i].articleName) + "-"
                + JSON.stringify(data[i].authorName) + "</a></li>");
        }

    });

});